package com.jackaltsc.mydemolist.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.jackaltsc.mydemolist.R;

/**
 * 主界面 点击不同的按钮进入不同的Demo界面
 */
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btnListView1, btnListView2;
    private Button btnExListView;
    private Button btnGridView;
    private Button btnSpinner;
    private Button btnListActivity;
    private Button btnRecyclerView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
    }

    private void initView() {

        btnListView1 = (Button) findViewById(R.id.btn_lv1);
        btnListView2 = (Button) findViewById(R.id.btn_lv2);
        btnExListView = (Button) findViewById(R.id.btn_exlv);
        btnGridView = (Button) findViewById(R.id.btn_gv);
        btnListActivity = (Button) findViewById(R.id.btn_la);
        btnSpinner = (Button) findViewById(R.id.btn_sp);
        btnRecyclerView = (Button) findViewById(R.id.btn_rv);

        btnListView1.setOnClickListener(this);
        btnListView2.setOnClickListener(this);
        btnExListView.setOnClickListener(this);
        btnGridView.setOnClickListener(this);
        btnListActivity.setOnClickListener(this);
        btnSpinner.setOnClickListener(this);
        btnRecyclerView.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {

            case R.id.btn_lv1:
                startActivity(new Intent(this, ListView1Activity.class));
                break;

            case R.id.btn_lv2:
                startActivity(new Intent(this, ListView2Activity.class));
                break;

            case R.id.btn_exlv:
                startActivity(new Intent(this, ExListViewActivity.class));
                break;

            case R.id.btn_gv:
                startActivity(new Intent(this, GridViewActivity.class));
                break;

            case R.id.btn_la:
                startActivity(new Intent(this, ListTActivity.class));
                break;

            case R.id.btn_sp:
                startActivity(new Intent(this, SpinnerActivity.class));
                break;

            case R.id.btn_rv:
                startActivity(new Intent(this, RecyclerViewActivity.class));
                break;

        }

    }
}
